#include "Command.hpp"
#include "Tcpserver.hpp"
#include <iostream>

std::string defaulthandle(const std::string &word, InetAddr &addr)
{
    LOG(LogLevel::DEBUG) << "回调到了defaultthanler";
    std::string s = "haha, ";
    s += word;
    return s;
}
void Usage(std::string proc)
{
    std::cerr<<"Usage: "<<proc<<"port"<<endl;
}
int main(int argc, char *argv[])
{
    if(argc!=2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port=std::stoi(argv[1]);
    Enable_Console_Log_Strategy();
    Command cmd; 
    std::unique_ptr<TcpSever> tsvr=std::make_unique<TcpSever>(port,bind(&Command::Execute,&cmd,std::placeholders::_1,std::placeholders::_2));
    tsvr->Init();
    tsvr->Run();
    return 0;
}